//
//  VKStudyDaCard3Cell.m
//  V-Learn
//
//  Created by liubo on 2019/2/13.
//  Copyright © 2019 yxk. All rights reserved.
//

#import "VKStudyDaCard3Cell.h"

@implementation VKStudyDaCard3Cell{
    UILabel *_titleLabel;
    UIImageView *_arrowImageV;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    VKStudyDaCard3Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"VKStudyDaCard3Cell"];
    if (cell == nil) {
        cell = [[VKStudyDaCard3Cell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"VKStudyDaCard3Cell"];
    }
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 点击cell的时候不要变色
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        
        // 布局子控件
        [self autoLayout];
    }
    return self;
}

-(void)setModel:(VKStudyDaCardModel *)model{
    _titleLabel.text = model.leftLabel;
    
}

- (void)autoLayout{
    
    UIImageView *imageV = [[UIImageView alloc]init];
    _imageV = imageV;
    imageV.clipsToBounds = YES;
    imageV.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:imageV];
    imageV.image = [UIImage imageNamed:@"vkadd"];
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.equalTo(@90);
        make.left.equalTo(@15);
        make.top.mas_equalTo(@20);
    }];
    
    self.textView = [[UITextView alloc]init];
    self.textView.layer.cornerRadius = 3;
    self.textView.layer.masksToBounds = YES;
    self.textView.layer.borderWidth = 1;
    self.textView.layer.borderColor = [UIColor cz_colorWithRed:204 green:204 blue:204].CGColor;
    self.textView.placeholder = @"描述";
    self.textView.placeholderColor = [UIColor cz_colorWithHex:0xFFB2B3B7];
    [self.contentView addSubview:self.textView];
    self.textView.font = [UIFont systemFontOfSize:17];
    self.textView.delegate = self;
    self.textView.backgroundColor = [UIColor whiteColor];
    [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imageV);
        make.right.equalTo(@(-15));
        make.top.mas_equalTo(imageV.mas_bottom).offset(16);
        make.height.equalTo(@120);
    }];
    
    UIButton *deleteBtn = [[UIButton alloc]init];
    _deleteBtn = deleteBtn;
    [self.contentView addSubview:deleteBtn];
    deleteBtn.layer.cornerRadius = 5;
    deleteBtn.layer.masksToBounds = YES;
    deleteBtn.layer.borderWidth = 1;
    deleteBtn.layer.borderColor = [UIColor cz_colorWithRed:230 green:69 blue:41].CGColor;
    [deleteBtn setTitle:@"   删除   " forState:UIControlStateNormal];
    [deleteBtn setTitleColor:[UIColor cz_colorWithRed:230 green:69 blue:41] forState:UIControlStateNormal];
    deleteBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.textView);
        make.top.mas_equalTo(self.textView.mas_bottom).offset(15);
        make.height.equalTo(@25);
    }];
    
}

@end
